<?php
session_start();
isLogin();

if(isset($_POST["Submits"])){
	$sql="select * from ".$prefix."member where m_username='".$_SESSION['admin']."' and m_psw='".md5($_POST['oldpass'])."'";
	$result=mysql_query($sql);
	if(!$arr=mysql_fetch_array($result)){
		reload_js("旧密码输入错误","index.php?cmd=psw");
	}else{
		if($_POST['conpass']!=$_POST['newpass']){
			reload_js("两次输入密码不相同","index.php?cmd=psw");
		}else{
			$sql="update ".$prefix."member set m_psw='".md5($_POST['newpass'])."' where m_username='".$_SESSION['admin']."'";
			if(mysql_query($sql)){
				reload_js("修改成功，请重新登录","login.php?act=logout");
			}else{
				reload_js("修改失败，原因：程序错误，请联系技术人员进行修改","index.php");
			}
		}
	}
}
?>
<script language="javascript" src="../templates/<?php echo $moban;?>/js/common.js"></script>
<script language="javascript">
changeWebTitle('密码修改');
</script>

<div class="ContentRight">
    <div class="ContentRightTop">
      <div class="BarLeft"></div>
      <div class="ContentRightTopText">密码修改</div>
      <div class="BarRight"></div>
      <div class="Cal"></div>
    </div>
    <div class="ContentRightBox">
	<form action="" method="post" name="passmodify">
      <table width="100%" cellpadding="0" class="Table1" bordercolor="#4ab902" border="1" cellspacing="0">
        <tr>
          <td height="25" align="right">当前用户：</td>
          <td><?php echo $_SESSION['admin'];?></td>
        </tr>
        <tr>
          <td width="22%" height="25" align="right">旧密码：</td>
          <td width="78%">            <input name="oldpass" type="text" id="oldpass" maxlength="20"/>          </td>
        </tr>
        <tr>
          <td height="25" align="right">新密码：</td>
          <td>            <input name="newpass" type="text" id="newpass"  maxlength="20"/>          </td>
        </tr>
        <tr>
          <td height="25" align="right">确认码：</td>
          <td>            <input name="conpass" type="text" id="conpass"  maxlength="20"/>          </td>
        </tr>
        
        <tr>
          <td height="25" align="right">版权所有：</td>
          <td><a href="http://www.fengsh8.com" target="_blank">风尚淘客程序</a></td>
        </tr>
        <tr>
          <td height="25" align="right">&nbsp;</td>
          <td>
            <input name="Submits" type="submit" id="Submits" value=" 提  交" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input name="Reset" type="reset" id="Reset" value=" 重 置 " />
         </td>
        </tr>
      </table>
	  </form>
    </div>
    <div class="Cal"></div>
  </div>